package org.knowm.xchange.deribit;

import static org.assertj.core.api.Assumptions.assumeThat;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.knowm.xchange.ExchangeFactory;
import org.knowm.xchange.deribit.v2.DeribitExchange;
import org.knowm.xchange.dto.meta.ExchangeHealth;

public class DeribitIntegrationTestParent {

  protected static DeribitExchange exchange;

  @BeforeAll
  static void init() {
    if (exchange == null) {
      exchange = ExchangeFactory.INSTANCE.createExchange(DeribitExchange.class);
    }
  }

  @BeforeEach
  void exchange_online() {
    // skip if offline
    assumeThat(exchange.getMarketDataService().getExchangeHealth())
        .isEqualTo(ExchangeHealth.ONLINE);
  }
}
